Automate #include refactoring in C++ [on hold]

Posted by Mikhail on Programmers See other posts from Programmers or by Mikhail
Published on 2014-05-27T14:27:40Z Indexed on 2014/05/27 15:57 UTC
Read the original article Hit count: 268

I have a big project with hundreds of files. And as it often happens to C++ projects, #include directives are in messed up. I want to refactor them to increase clarity, decrease compilation time and simplify analysis.

For each .h file I want to make sure that:

  • It have #include directives only for types it is using
  • But it have only forward declarations of types that are used as T* or T&

For each .cpp file I want to make sure that:

  • It have #include directives only for types it is using and not already included by another headers (no indirect includes when possible)

I'm looking for a tool which will help me to automate this refactoring. For now I only know of tools that helps to remove redundant includes, they are many:

  • PC-lint
  • include-what-you-use
  • cppclean
  • ProFactor IncludeManager

But I know of no tools to help me to move necessary includes in .h files or replace includes with forward declarations. Any ideas? Tools for Windows and Visual Studio are preferred.

Update. Considered to be off-topic. Please, follow the link on Software Recommendations http://softwarerecs.stackexchange.com/q/4461/3331

© Programmers or respective owner

Related posts about c++

Related posts about refactoring